unit langs;
interface
uses crt; 
const
	filemode : byte = 2;
	default : string = 'lang = en';
	infoPl : string = #77+#117+#108+#116+#105+#99+#114+#121+#112+#116+#105+#120+#32+#48+#46+#51+#98+#49+#46+#32+#83+#116+#119+#111+#114+#122+#111+#110+#101+#32+#112+#114+#122+#101+#122+#32+#77+#97+#114+#99+#105+#110+#97+#32+#77+#105+#101+#108+#110+#105+#99+#122+#117+#107+#97+#44+#32+#50+#48+#49+#48+#46+#32+#85+#122+#121+#119+#97+#115+#122+#32+#112+#114+#111+#103+#114+#97+#109+#32+#110+#97+#32+#119+#108+#97+#115+#110+#101+#32+#114+#121+#122+#121+#107+#111+#32+#59+#41;
	infoEn : string = #77+#117+#108+#116+#105+#99+#114+#121+#112+#116+#105+#120+#32+#48+#46+#51+#98+#49+#46+#32+#67+#114+#101+#97+#116+#101+#100+#32+#98+#121+#32+#77+#97+#114+#99+#105+#110+#32+#77+#105+#101+#108+#110+#105+#99+#122+#117+#107+#44+#32+#50+#48+#49+#48+#46+#32+#85+#115+#101+#32+#97+#116+#32+#121+#111+#117+#114+#32+#111+#119+#110+#32+#114+#105+#115+#107+#32+#59+#41;
var
	info, lng : string;
//language array
	language : array[1..27] of string;
	n, m, l, io2 : byte;
	parameter : string[4];
	cfg : text;
	lngbak : string;
procedure readCfg();
implementation
procedure readCfg();
	var
		f : text;
		m, x : byte;
		parameter : string[4];
		langDetected : boolean;
		loadedlng : string;
	begin
	{$I-}
	assign(cfg,'multicryptix.cfg');
	reset(cfg);
	m := ioresult;
	if m = 2 then begin
		langDetected := true;
		rewrite(cfg);
		write(cfg, default);
		parameter := 'lang';
		lng := default;
		close(cfg);
		end
	else if m = 0 then begin
		langDetected := true;
		repeat
		readln(cfg, lng);
		parameter := lng;
		writeln('Language loaded: ', lng[length(lng)-1], lng[length(lng)]);
		until (parameter = 'lang') or eof(cfg);
		end
	else writeln('Multicryptix has encountered an error with code', m);
	if langDetected = true then begin
		if lng = 'lang = pl' then assign(f, 'polish.lng')
		else if lng = 'lang = en' then assign(f, 'english.lng');
		reset(f);
		for x := 1 to 26 do readln(f, language[x]);
		if lng = 'lang = pl' then language[27] := infoPl
		else if lng = 'lang = en' then language[27] := infoEn;
		close(f);
		end;
	if langDetected = true then delay(750)
	else delay(2000);
	{$I+}
	end;
end.
